home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / vopl / glvopl.lha / glvopl / src / vopl.h < prev   
Encoding:
C/C++ Source or Header  |  1993-10-08  |  2.0 KB  |  127 lines

  1. #include <stdio.h>
  2.  
  3. #define MAX(a,b)    ((a) > (b) ? (a) : (b))
  4. #define MIN(a,b)    ((a) < (b) ? (a) : (b))
  5. #define ABS(a)        ((a) < 0.0 ? (-a) : (a))
  6.  
  7. #define    EBUF_SIZE    100        /* size of error message buffer */
  8. #define    LABEL_LEN    50        /* max length of an axis label */
  9.  
  10. /*
  11.  * fits
  12.  */
  13. #define    NO_LINES    0
  14. #define    STRAIGHT_LINE    1
  15. #define LEAST_SQUARE    2
  16. #define CUBIC_SPLINE    3
  17. #define    POWER_EQN    4
  18. #define    SGR_FIT        5
  19.  
  20. #define    MAX_FIT        5        /* must be maximum fit number */
  21.  
  22. /*
  23.  * spline types
  24.  */
  25. #define    FREE        0
  26. #define    CLAMPED        1
  27.  
  28. /*
  29.  * scalings
  30.  */
  31. #define    LINEAR        0
  32. #define    LOGARITHMIC    1
  33.  
  34. /*
  35.  * boundaries in which the graph is plotted
  36.  */
  37. #define    XMIN        -0.7
  38. #define    YMIN        -0.7
  39. #define    XMAX        1.0
  40. #define    YMAX        0.8
  41.  
  42. /*
  43.  * size of line-markers on axes
  44.  */
  45. #define    LINELEN        0.02
  46.  
  47. /*
  48.  * textsizes
  49.  */
  50. #define    TEXTHEIGHT    0.05
  51. #define    TEXTWIDTH    0.035
  52.  
  53. /*
  54.  * marker size
  55.  */
  56. #define    MARKERSIZE    0.05
  57.  
  58. /*
  59.  * A big number (Some PC things don't seem to have this in math.h)
  60.  */
  61. #define BLOODYBIG    1.0e38
  62.  
  63. /*
  64.  * Enlarge the viewport a smidge so that anotations don't get clipped.
  65.  */
  66. #define FUDGE        0.075
  67.  
  68. extern float    *newm1(), **newm2();
  69.  
  70. extern float    cardinal[4][4];
  71.  
  72. /*
  73.  * axis indexes
  74.  */
  75. #define    XIND        0
  76. #define    YIND        1
  77. #define    ZIND        2
  78.  
  79. #define    AXES        3    /* number of axes */
  80.  
  81. typedef struct AXISDATA {
  82.     float    min,
  83.         max,
  84.         div;
  85.     int    scaling,
  86.         annotate,
  87.         nticks,
  88.         ntspacing,
  89.         minorticks,
  90.         scaleset;
  91.     char    *format,
  92.         *title;
  93. } axisdata;
  94.  
  95. typedef struct VOPL {
  96.     float        s1, sn,
  97.             markerscale;
  98.  
  99.     int        fit, 
  100.             degree,
  101.             splinetype,
  102.             grid, 
  103.             startind, arrayind,
  104.             precision,
  105.             markerspacing,
  106.             forceticks;
  107.         
  108.     char        *marker,
  109.             *graphtitle;
  110.  
  111.     axisdata    axes[AXES];
  112. } vopldev;
  113.  
  114. extern vopldev    plotdev;
  115.  
  116. extern    double    log10();
  117.  
  118. extern    char    *savestr();
  119. extern    char    *malloc();
  120.  
  121. #define WhatX(x) (plotdev.axes[XIND].scaling == LINEAR ? \
  122.                 (x) : (float)log10((double)(x)))
  123. #define WhatY(y) (plotdev.axes[YIND].scaling == LINEAR ? \
  124.                 (y) : (float)log10((double)(y)))
  125. #define WhatZ(z) (plotdev.axes[ZIND].scaling == LINEAR ? \
  126.                 (z) : (float)log10((double)(z)))
  127.